<?php
$customer = Mage::getSingleton('customer/session')->getCustomer();
?>
<style type="text/css">
	.contact_form input,.contact_form textarea{color:#888;}
</style>
<form action="<?php echo $this->getFormAction();?>" method="post" id="contact_form">
<input type="hidden" name="type" value="1">
<div class="feedback group-select">
	<div class="input-field-set">
		<div class="input-box">
			<label for="salutation"><?php echo $this->__("Salutation");?></label>
			<span class="required">*</span><br />
			<select name="title" style="width:80px;">
				<option value="1" <?php echo ( $this->getFormData()->getData('title') == 1 ) ? 'selected="selected"':'';?>><?php echo $this->__("Mr.");?></option>
				<option value="2" <?php echo ( $this->getFormData()->getData('title') == 2 ) ? 'selected="selected"':'';?>><?php echo $this->__("Mrs.");?></option>
				<option value="3" <?php echo ( $this->getFormData()->getData('title') == 3 ) ? 'selected="selected"':'';?>><?php echo $this->__("Miss");?></option>
			</select>
		</div> 
	</div>
	<div class="input-field-set">				
		<div class="input-box">
			<label for="firstname"><?php echo $this->__("First Name");?></label>
			<span class="required">*</span><br />
			<input type="text" name="first_name" value="<?php echo $this->getFormData()->getData('first_name');?>" class="input-text required-entry"  style="width:240px;">
		</div>
		<div class="input-box">
			<label for="lastname"><?php echo $this->__("Last Name");?></label>
			<span class="required">*</span><br />		
			<input type="text" name="last_name" value="<?php echo $this->getFormData()->getData('last_name');?>" class="input-text required-entry" style="width:240px;">
		</div>		
	</div>
					
	<div class="input-field-set">
		<div class="input-box">
			<label for="telephone"><?php echo $this->__("Contact Telephone");?></label>
			<span class="required">*</span><br />		
			<input type="text" name="tel" value="<?php echo $this->getFormData()->getData('tel');?>" class="input-text required-entry" style="width:240px;">
		</div>
		<div class="input-box">
			<label for="telephone"><?php echo $this->__("Email Address");?></label>
			<span class="required">*</span><br />		
			<input type="text" name="email" value="<?php echo $this->getFormData()->getData('email');?>" class="validate-email input-text required-entry" style="width:240px;">
		</div>
	</div>
		
	<div class="input-box">
		<label for="salutation"><?php echo $this->__("Feedback Or Comment");?></label>
		<span class="required">*</span><br />			
		<textarea name="content" rows="12" cols="50" class="enquiry_text required-entry" style="width: 500px;height:80px;color:#888;"><?php echo $this->getFormData()->getData('content');?></textarea>

	</div>
	<div class="validation">	
		<label for="salutation"><?php echo $this->__("Verification:");?></label>
		<span class="required">*</span><br />		
		<img src="<?php echo $this->getUrl("contacter/index/validation");?>?width=80&amp;height=23">
		<input type="text" name="validation" value="" class="input-text required-entry" style="width:50px;">	<br />			
		<span class="tips"><?php echo $this->__('Type the characters you see in the picture.');?></span>
	</div>
</div>
<div class="product_list">
	<?php
	$current_locale_code = $this->getCurrentStore()->getLocaleCode();
	$current_locale_code = substr( $current_locale_code,0,2 );
	$currency = Mage::app()->getLayout()->getBlock("currency")->getCurrencyOptions( Mage::app()->getLayout()->getBlock("currency")->getCurrentCurrencyCode() );
	$session = Mage::getSingleton('catalog/session');	
	?>
	<?php $product_collection = $this->getProductList();?>
	
	<?php if( $product_collection && $product_collection->getSize() ):?>
		<?php $line_color_sets = array( "#ffffff","#f9fafb" );?>
		<?php $color_count = count( $line_color_sets );?>
		<?php $line_counter = 1;?>
		<?php $_helper = $this->helper('catalog/output');?>
		<?php foreach( $product_collection as $_product ):?>	
		<?php $_tierPrices = $this->getTierPrices( $_product );?>
				<?php 
					if (!$_tierPrices){
						$_tierPrices = array();
						$_tierPrices[0]['price_qty'] = 1;
						$_tierPrices[0]['price'] = $this->helper('tax')->getPrice($_product, $_product->getPrice());
					}
					$bg_color = $line_color_sets[ $line_counter++%$color_count ];
				?>
				<table width="100%" cellspacing="0" cellpadding="0" align="center">
					<tbody>
						<tr bgcolor="<?php echo $bg_color;?>">
							<td class="product_image">
							<?php
									$_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(80).'" width="80" height="80" alt="'.$this->htmlEscape( $_product->getName() ).'" title="'.$this->htmlEscape( $_product->getName() ).'" />';
									echo $_helper->productAttribute($_product, $_img, 'image');
								?>
							</td>
							<td class="product_info">
								<a href="<?php echo $_product->getProductUrl();?>"><?php echo $_product->getName();?></a>
								<p><?php echo $this->__("Model:");?>&nbsp;<?php echo $_product->getData('model');?></p>
								<p><?php echo $this->__("We have <b>%d</b> in stock.",(int)$_product->getQty());?></p>
							</td>
							<td class="make_offer">
									<input type="hidden" name="product_id[]" value="<?php echo $_product->getId();?>">
									<p>
										<span><?php echo $this->__("My Offer On %s Units Is For %s Per Unit","<input type=\"text\" id=\"offer_qty_".$_product->getId()."\" value=\"".$this->getOfferQty( $_product->getId() )."\" name=\"offer_qty[]\" onbeforepaste=\"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));\" onkeyup=\"value=value.replace(/[^\d]/g,'');\">",$currency['symbol']."<input type=\"text\" value=\"".$this->getOfferPrice( $_product->getId() )."\"  id=\"offer_price_".$_product->getId()."\" name=\"offer_price[]\" onbeforepaste=\"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));\" onkeyup=\"value=value.replace(/[^\d]/g,'');\">");?></span>
									</p>
							</td>
						</tr>
				</tbody></table>	
		<?php endforeach;?>
		<a href="<?php echo $this->getUrl("index.php");?>" title="<?php echo $this->__("Add more to the list");?>"><?php echo $this->__("Add more to the list");?></a>
	<?php else:?>	
		<a href="<?php echo $this->getUrl("make-offer");?>" title="<?php echo $this->__("Add product to the list");?>"><?php echo $this->__("Add product to the list");?></a>
	<?php endif;?>	
</div>
<div class="action"><input type="image" name="submit_button" src="<?php echo $this->getSkinUrl()?>images/MakeOffer_<?php echo $current_locale_code;?>.gif" id="contact_submit"></div>
</form>
<script type="text/javascript">
//<![CDATA[
var dataForm = new VarienForm('contact_form', true);
//]]> 
</script>